Week 2 Analysis
library(mosaic)
library(tidyverse)
library(pander)
library(DT) # If you get an error stating:
# Error in library(DT): there is no package called 'DT'
# You will need to run: install.packages("DT")
# in your Console, then try "Knit HTML" again.
library(plotly)
library(ggplot2)
Rent <- read_csv("../Data/Rent.csv")
Stephanie1 is a student that will be starting school at BYU-Idaho next semester. Suppose she sent you the following email.
“Hi. My name is Stephanie. I would like to learn about what housing options I have for living at BYU-Idaho next semester. It will be my first semester there, so I would like to find something that is close to campus and around $300 a month in rent. I’m not too picky on roommates, but I would like somewhere that has a lot of people around so I can get to know as many people as possible. Thanks in advance!”
Write your response to Stephanie below. Use the “Rent” dataset, good statistical analysis, and clear writing to make some well supported suggestions to her about apartments that meet her stated criterions. You are free to use other criterion that you think she might find more meaningful as well.
Dear Stephanie,
Thank you for reaching out to get some help with your housing search. There are over 50 different women apartment complexes in Rexburg. To find the most suitable housing options for you, I conducted a analysis based on your interests and preferences. Now the question is: Which one of the apartment complexes in Rexburg has the best mix of price (about $300 a month), proximity to campus, and number of students?
To answer the above question I took the time to create 3 table that contain the top 5 housing complexes for each on of your interests.
RentWomen <- Rent %>%
filter(Gender=="F", Price<1205, Capacity>70, WalkingMinutes<7) %>%
select(c(Apartment, Gender, Price, Capacity, WalkingMinutes, ParkingStalls, Website, Phone, MilesToCampus))%>%
mutate(MonthlyPrice = Price/4)
Top5Price <- RentWomen %>%
filter(Price<999)
barplot(c(AspenVillage=900/4, BirchPlaza=980/4, Cottonwood=950/4, Davenport=895/4, RoyalCrest=995/4), col="pink", main="Top 5 Apartments with the Lowest Price", ylab = "Price $$$ per Month")
Top5Capacity <- RentWomen %>%
filter(Capacity>209)
barplot(c(AspenVillage=210, BirchPlaza=343, RoyalCrest=342, LaJolla=234, CarriageHouse=234), col="pink", main="Top 5 Apartments with the highest Capacity", ylab = "Apartment Complex Student Capacity")
Top5Proximity <- RentWomen %>%
filter(MilesToCampus<0.19)
barplot(c(AllensVillage=1, BirchPlaza=1, CarriageHouse=2, Davenport=4, LaJolla=4), col="pink", main="Top 5 with the Least Waking Minutes to Campus", ylab = "Waking Minutes to Campus")
Note: Birch Plaza Apartments was the best option for categories 2 (Capacity) and 3 (Proximity to Campus)
Each one of the options below will fulfill your requirement, however, I have a few more thing to show to you before you make your decision.
In this graph below you can ses all different apartment complexes that will cover your needs. They have been place with pink dots depending on the capacity of the apartment complex and the price a semester. In this case I want you to take a close look at the two dots placed at the top between prices 950 ~ 1000 and almost reaching capacity of 350.
defaultW <- getOption("warn")
options(warn = -1)
plot_ly(RentWomen,
x= ~Price,
y= ~Capacity,
size= ~WalkingMinutes,
text= ~paste("Name:", Apartment, "\n", "Monthly Price:", MonthlyPrice),
color=c("deeppink"))%>%
add_trace(Price = c(1, 2, 3), Capacity = c(1, 3, 1), type = 'scatter', mode = 'markers')%>%
layout(title="Best Housing Choice",
xaxis=list(title="Semester Price"),
yaxis=list(title="Capacity of Students"))
options(warn = defaultW)
The two dots mentioned above represent the best combination of price, proximity to campus, and complex capacity for you to meet new people. These two dots represent Birch Plaza on the left and Royal Crest on the right. As you can see they both have approximately the same capacity of students, but they have two differences: 1. Birch Plaza is slightly less expensive and 2. Birch plaza is only 1min-walk to campus.
My recommendation is that overall Birch Plaza will be the best fit for your needs, and the place where you will be able to meet more people because they have capacity for more than 340 students, you will be paying $245 a semester, and it’s only 1min-walk from campus.
# Code to get you started, be sure to use a subset of Rent instead of Rent in this code though.
datatable(RentWomen, options=list(lengthMenu = c(3,5,10)), extensions="Responsive")
Note that Stephanie is a fictional character who is based on real experiences of many faculty and staff here at BYU-Idaho.↩︎